package com.example.springboot.mapper;

import com.example.springboot.pojo.Img;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.GetMapping;

@Mapper
public interface HomeMapper {

    @Insert("insert into img(url) values(#{url})")
    void uploadImg(String url);

    @Select("select * from img")
    Img[] getAllImg();

    @Select("select url from img where id=#{id}")
    String findById(Integer id);

    @Delete("delete from img where id=#{id}")
    void deleteImg(Integer id);
}
